package org.shiro.auth.client.filter;

public class RpcResponse {

  private boolean flag;
  private int     code;
  private String  message;
  private Object  data;

  public static RpcResponse success(Object data) {
    RpcResponse rpcResponse = new RpcResponse();
    rpcResponse.setCode(0);
    rpcResponse.setFlag(true);
    rpcResponse.setData(data);
    rpcResponse.setMessage("操作成功");
    return rpcResponse;
  }

  public static RpcResponse fail() {
    RpcResponse rpcResponse = new RpcResponse();
    rpcResponse.setCode(1);
    rpcResponse.setFlag(false);
    rpcResponse.setMessage("操作失败");
    return rpcResponse;
  }

  public boolean getFlag() {
    return flag;
  }

  public void setFlag(boolean flag) {
    this.flag = flag;
  }

  public int getCode() {
    return code;
  }

  public void setCode(int code) {
    this.code = code;
  }

  public String getMessage() {
    return message;
  }

  public void setMessage(String message) {
    this.message = message;
  }

  public Object getData() {
    return data;
  }

  public void setData(Object data) {
    this.data = data;
  }

}
